package com.wc.算法基础课.B第二讲数据结构.线段树.动态求连续区间和;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/23 22:55
 * @description https://www.acwing.com/problem/content/1266/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[] a = new int[N];
    // 线段树要乘以4
    static int[] s = new int[N << 2];
    static int n, m, op, l, r;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        build(1, n, 1);
        while (m-- > 0) {
            op = sc.nextInt();
            l = sc.nextInt();
            r = sc.nextInt();
            if (op == 0) {
                out.println(query(1, n, 1, l, r));
            } else {
                update(1, n, 1, l, r);
            }
        }
        out.flush();
    }

    static int query(int l, int r, int t, int ql, int qr) {
        if (l == ql && r == qr) {
            return s[t];
        }
        int mid = l + r >> 1;
        if (mid >= qr) return query(l, mid, t << 1, ql, qr);
        else if (mid + 1 <= ql) return query(mid + 1, r, t << 1 | 1, ql, qr);
        return query(l, mid, t << 1, ql, mid) + query(mid + 1, r, t << 1 | 1, mid + 1, qr);
    }

    static void update(int l, int r, int t, int u, int b) {
        if (l == r) {
            s[t] += b;
            return;
        }
        int mid = l + r >> 1;
        if (mid >= u) update(l, mid, t << 1, u, b);
        else update(mid + 1, r, t << 1 | 1, u, b);
        pushUp(t);
    }

    static void build(int l, int r, int t) {
        if (l == r) {
            s[t] = a[l];
            return;
        }
        int mid = l + r >> 1;
        build(l, mid, t << 1);
        build(mid + 1, r, t << 1 | 1);
        pushUp(t);
    }

    static void pushUp(int t) {
        s[t] = s[t << 1] + s[t << 1 | 1];
    }

}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
